 |
|
 |
Subject: Lotus Script - Error 4000 |
 |
 |
 |
Product Area: Other |
 |
Technical Area: Error Message |
 |
Platform: Windows |
 |
Release: 8.5.2 |
 |
Reproducible: Intermittent |
 |
 |
 |
 |
We have a piece of code in a clients email client. It is a button on the memo form that allows the user to look up a project ID (from the project database) create a new correpodence document (in the project database) and render the memo into the Rich Text Field called body, in the correposdence document. The goal of the code is to attach a copy of all correspondence relating to a project to the main project document as a related (but not response) document.
The code fails at line 61 which says, doc.save(true, false)
The error number is 4000.
The error message is about an invalid or missing document.
This error occurs on different memo docs being attached to different projects by the same user. It doesn't always occur.
ProjectDb and Mail Db are both on the server.
User has editor acccess with delete rights to both databases.
The code looks as follows.
Function AttachMemoToProject() As Boolean
Dim w As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim s As NotesSession
Dim db As NotesDatabase 'project database
Dim appDir As clsAppDir
Dim doc As NotesDocument
Dim prjDoc As NotesDocument
Dim rtfBody As NotesRichTextItem
Dim prjDocUNID As String
On Error Goto errAppDir
Set appDir = New clsAppDir
On Error Goto errHandle
Set s = New NotesSession
' appDir allows us to lookup databases and settings from a global directory
If appDir.GetAppDb( "EE_JOBS" , db) = False Then
Error 32767, "Unable to open the Jobs database using lookup code of 'EE_JOBS'" + Chr$(13) + "Please check it is registered in the App Dir DB"
End If
'Returns a project ID as a string
prjDocUNID = LookupProjectDocUNID( db )
If prjDocUNID = "" Then
Msgbox "Attaching to project document has been cancelled", MB_ICONINFORMATION, "Attach Cancelled"
Else 'we have a prjUNID
Set prjDoc = db.GetDocumentByUNID( prjDocUNID )
If prjDoc Is Nothing Then
Msgbox "Unable to find the project document."
Else 'we have a projectdocument
Set uidoc = w.CurrentDocument ' the current open email
If uidoc.ModifiedSinceSaved Then
If Msgbox ("Do you want to save changes before sending this document." , MB_ICONQUESTION + MB_YESNO, "Save Changes?") = IDYES Then
Call uidoc.Save()
End If 'msgbox ...
End If
Set doc = New NotesDocument(db)
If IsSentMail( uidoc.Document ) Then
doc.Form = "OutwardsMailDoc"
Else
doc.Form = "InwardsMailDoc"
End If
doc.Type="ProjectCorrespondence"
doc.ProjectNumber = prjDoc.ProjectNumber(0)
doc.FirstName = prjDoc.FirstName(0)
doc.LastName = prjDoc.LastName(0)
doc.Reference = prjDoc.Reference(0)
doc.From = uidoc.FieldGetText("From")
doc.Subject = uidoc.FieldGetText("Subject")
doc.DateReceived = uidoc.Document.Created
doc.MailHeader = GetMailHeader( uidoc.Document )
Set rtfBody = New NotesRichTextItem( doc, "Body")
Call uidoc.Document.RenderToRTItem(rtfBody)
' ERROR occurs on the next line but the doc is still saved.
Call doc.Save(True, False)
With prjDoc
Msgbox "Email attached to project " + .ProjectNumber(0) + " - " + .FirstName(0) + " " + .LastName(0)
End With
End If 'prjDoc is nothing
End If 'prjUNID <> ""
finalExit:
On Error Resume Next
Set appDir = Nothing
Set prjDoc = Nothing
Set rtfBody = Nothing
Set doc = Nothing
Set db = Nothing
Set s = Nothing
Set uidoc = Nothing
Set w = Nothing
Exit Function
errAppDir:
Msgbox "There was an error getting the application directory." + Chr$(13) + "Err Msg: " + Error$, MB_ICONEXCLAMATION, "Error Getting Application Directory"
Err = 0
Goto finalExit
errHandle:
Msgbox "There was an error Attaching Memo To Project" + Chr$(13) + "Err Msg: " + Error$ + Chr$(13) + "On Line: " + Cstr( Erl) + Chr$(13) + "Err Num: " + Cstr( Err), MB_ICONEXCLAMATION, "Error [UI_JobsLib.AttachMemoToProject]"
Err = 0
Goto finalExit
End Function
 
Feedback number WEBB8LV953 created by ~Sigmund Mingeroburakoi on 09/20/2011

Status: Open
Comments:

Lotus Script - Error 4000 (~Sigmund Minger... 20.Sep.11)
. . 4000 = Network Dialup link failed. ... (~Arnold Zenjumi... 20.Sep.11) |
|  |
|